<html><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>销售月报</title>

  <#assign base=request.contextPath  />
    <base id="basePath" href="${base}">

    <base id="basePath" href="${base}">
    <link rel="stylesheet" href="${base}/css/demo.css" type="text/css">
    <link rel="stylesheet" href="${base}/css/zTreeStyle.css" type="text/css">
    <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="${base}/js/ztree/jquery.ztree.exedit.js"></script>

    <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
    <style type="text/css">
        form {
            padding: 20px;
        }

        .layui-btn-radius {
            border-radius: 10px;
        }
    </style>
</head>

<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>销售月报</legend>
</fieldset>
<div class="demoTable" style="height: 40px;">

    <div class="layui-inline layui-form" style="float:right;" >
        <div class="layui-input-inline">
            <select name="modules" lay-verify="required" id="sech" lay-search="">
                <option value="">请选择要搜索的列</option>
                <option value="person">姓名</option>
            </select>
        </div>
        <div class="layui-inline">
            <input class="layui-input" name="id" id="demoReload" autocomplete="off">
        </div>
        <button class="layui-btn layui-btn-radius" id="btn1" data-type="reload" style="background-color: #0092EF;">搜索</button>
    </div>
</div>
<table class="layui-hide" id="table_user" lay-filter="user"></table>

<script type="text/html" id="barDemo">
    <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="edit" id="updatemother" href="javascript:void(0)"  onclick="detailed('{{d.person}}')">详细明细</button>
</script>

<script src="${base}/js/layui/layui.js" charset="utf-8"></script>
<script src="${base}/js/jquery.min.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate','table'], function(){
        var form = layui.form
                ,$ = layui.jquery
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate
        table = layui.table;
        //方法级渲染
        table.render({
            elem: '#table_user'
            ,url: '${base}/situationAnalysis/selectCount'//数据接口
            ,toolbar: '#toolbarDemo'
            ,defaultToolbar: ['filter', 'print', 'exports']
            ,cols: [[
                {field:'id',templet:function(val){return val.LAY_INDEX},title:'ID',align: 'center', width:60, field: true}

                ,{field:'person', title: '姓名',align: 'center'}
                ,{field:'money', title: '总金额',align: 'center'}
                ,{field:'count', title: '单数',align: 'center'}
                ,{field:'dept', title: '部门', align: 'center'}
                ,{field: 'right', title:'操作', toolbar: '#barDemo',width:150, align: 'center'}
            ]]
            ,id: 'testReload'
            ,page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                ,theme: '#0092EF'
                ,limit:20
            }  ,done: function(res, curr, count){
                this.where={};
            }
            ,height:500
        });
        layui.form.on('select()', function(data){
            $("#demoReload").val("")
        });
        //详细信息弹出层
        table.on('tool(user)', function(obj){
            var layEvent = obj.event;
            if(layEvent=="edit"){
                var data = obj.data;
                layer.open({
                    type: 2,
                    title: '详细信息',
                    shadeClose:false ,
                    offset: 't',
                    area:['720px','100%'],
                    content: '${base}/situationAnalysis/frame?person='+data.person,
                });
            }
        });

        layui.form.on('select()', function(data){
            $("#demoReload").val("")
        });
        //实现搜索
        $('#btn1').on('click', function(){
            var sechLin=$("#sech").val();
            var sechData=$("#demoReload").val();
            var whereData={};
            whereData.lin=sechLin;
            whereData.data=Trim(sechData);

            var table = layui.table;
            //表刷新方法
            table.reload('testReload', {
                url:'${base}/situationAnalysis/selectCount'
                ,where: whereData //设定异步数据接口的额外参数
            });
        });
        String.prototype.trim = function() {
            return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
        }

















    });
    //键盘事件
    $("body").bind("keydown",function(e){
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            //回车执行查询
            $("#btn1").click();
        }
    });
    /*
        //点击详细明细弹框
        function detailed(person){
            alert(person)
            $.ajax({
                type:"POST",
                url:"${base}/situationAnalysis/selectByPerson",
            data:{"person":person},
            async:false,
            success:function(data){
                //alert(456)
            }
        });
    }
*/


</script>



</body>
</html>